// 版权归陈超所有

#pragma once

#include "CoreMinimal.h"
#include "AbilitySystemInterface.h"
#include "GameFramework/Character.h"
#include "Interations/CC_CombatInterface.h"
#include "CC_CharacterBase.generated.h"


class UCC_AttributeSet;
class UCC_AbilitySystemComponent;
class UGameplayAbility;
class UGameplayEffect;
class UAbilitySystemComponent;
class UAttributeSet;
class USkeletalMeshComponent;

UCLASS(Abstract)
class CC_AURA_API ACC_CharacterBase : public ACharacter,public IAbilitySystemInterface, public ICC_CombatInterface
{
	GENERATED_BODY()

public:
	// 设置此角色属性的默认值
	ACC_CharacterBase();
	
/*重写ASC接口函数:
 *		1.获取能力系统组件
*/
#pragma region IAbilitySystemInterface
	virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
#pragma endregion
	
	//获取属性集
	virtual UAttributeSet* GetAttributeSet() const {return AttributeSet;};

protected:
	// 在游戏开始或生成时调用
	virtual void BeginPlay() override;

	UPROPERTY(EditAnywhere,Category="Combat")
	TObjectPtr<USkeletalMeshComponent> Weapon;

	UPROPERTY()
	TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;

	UPROPERTY()
	TObjectPtr<UCC_AbilitySystemComponent> CC_AbilitySystemComponent;

	UPROPERTY()
	TObjectPtr<UAttributeSet> AttributeSet;

	UPROPERTY()
	TObjectPtr<UCC_AttributeSet> CC_AttributeSet;

protected:
	//初始化能力演员信息
	virtual void InitCharacterASC();

	/*属性效果*/
	UPROPERTY(BlueprintReadOnly,EditAnywhere,Category="Attributes|Primary")
	TSubclassOf<UGameplayEffect> DefualtPrimaryAttributes;
	
	UPROPERTY(BlueprintReadOnly,EditAnywhere,Category="Attributes|Secondary")
	TSubclassOf<UGameplayEffect> DefualtSecondaryAttributes;
	
	UPROPERTY(BlueprintReadOnly,EditAnywhere,Category="Attributes|Vital")
	TSubclassOf<UGameplayEffect> DefualtVitalAttributes;
	
	void ApplyEffectToSelf(TSubclassOf<UGameplayEffect> GameplayEffectClass, float Level) const;
	
	/*初始化角色主要属性*/
	void InitCharacterDefaultAttribute() const;

/*
 * 角色能力
 */
#pragma region Abilities
	
protected:
	void AddCharacterAbilities();
	
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="CC|Abilities")
	TArray<TSubclassOf<UGameplayAbility>> StartupAbilities;			//初始能力

#pragma endregion

	
};
